<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class TestGcm extends CI_Controller {
	function __construct() {

		parent::__construct();

	}

	function testpush(){
		
		$regId="APA91bF7VNtwgWrYNBV7EOJMS7oR8fCKnhSuW3qdg3f78TJQoVQe5TFJ8_HODec5-_EKlEN4pIL9eYs980uqfxZybTAO1iSPixM9ynx-gWC43NaaeWkvAp7_4RcxJZSH2yEwNq7q5sc9YeWW779jGyQ7XHrz3ivbfg";
		$msg="dffffffffffffff gggfdsgf";
		$message = array("price" => $msg);
		$regArray[]=$regId;
		$url = 'https://android.googleapis.com/gcm/send';

		$fields = array('registration_ids' => $regArray, 'data' => $message);
		$headers = array( 'Authorization: key=','Content-Type: application/json');

		$ch = curl_init();

		curl_setopt($ch, CURLOPT_URL, $url);
		curl_setopt($ch, CURLOPT_POST, true);
		curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
		curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
		curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields));

		$result=curl_exec($ch);
		echo $result; 
		if($result==FALSE)
		{
		    die('Curl Failed');
		}
		curl_close($ch);
	}

}


